
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<!-- 编辑器公式插件 -->
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>
<style>
    #login-button{
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
        border-radius: 3px;
    }
    .link-update{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }

</style>

<div class="span10">
    <div style="margin-bottom: 20px">
        <a href="/index/index">首页</a><span >&gt;</span><span><a href="<?=\yii\helpers\Url::to(['information/index','page'=>$page,'belong'=>$belong])?>">第三方资讯管理</a></span><span >&gt;</span><span>查看详情</span>
    </div>
    <form name="form" method="post" action="" id="registerform" enctype="multipart/form-data">
        <table>
            <tr>
                <td width="80px">标题 *:</td>
                <td><input type="text" name="name" placeholder="标题" style="width: 500px;" value="<?=$information['name']?>"></td>
            </tr>
            <tr>
                <td>类别 *:</td>
                <!--                <td><input type="text" name="cate" placeholder="类别"></td>-->
                <td>
                    <select name="cate" id="cate" >
                        <?php foreach($cates as $key=>$value){?>
                        <option value ="<?=$key?>" <?php if($key==$information['cate']) echo "selected";?>><?=$value?></option>
                        <?php }?>
                    </select>
                </td>
            </tr>
            <tr id="name"  >
                <td>作者：</td>
                <td>
                    <input type="text" name="author" placeholder=""  style="width: 500px;" value="<?=$information['author']?>" />
                </td>
            </tr>

            <?php if(isset($information)) {
                $str = '<tr>';
                $str .= '<td>原图片:</td>';
                $str .= '<td>';
                $pic = $information['pic'];
                $str .= "<input name='pic' type='text' value='" . $pic . "'></td></tr>";
                echo $str;
            } ?>
            <tr>
                <td>内容图片*:</td>
                <td>
                    <input id="file" type="file" name="pic" >
                </td>
            </tr>
            <tr id="summary">
                <td>摘要：</td>
                <td>
                    <input type="text" name="summary" placeholder=""  style="width: 500px;" value="<?=$information['summary']?>" />限200字内
                </td>
            </tr>
            <tr>
                <td>关键词：</td>
                <td>
                    <input type="text" name="keywords" placeholder=""  style="width: 500px;" value="<?=$information['keywords']?>" />限200字内
                </td>
            </tr>
            <tr>
                <td>内容：</td>
                <td id="content">
                  <textarea style="width: 800px" id="editor" class="editor"
                            name="content"><?=$information['content']?></textarea>
                    <script>var editor = UE.getEditor('editor');</script>
                </td>
            </tr>

            <tr>
                <td>初始化点击量:</td>
                <td>
                    <input type="text" name="viewCount" placeholder=""  style="width: 500px;" value="<?=$information['viewCount']?>" />
                </td>
            </tr>
            <tr>
                <td>排序:</td>
                <td>
                    <input type="text" name="sort" value="<?=$information['sort']?>"  />
                </td>
            </tr>
            <tr>
                <td>是否置顶:</td>
                <input type="hidden" name="isTop" class="isTop" value="<?=$information['isTop']?>">
                <td>
                    <?php if ($information['isTop']==1) {?>
                        <a class="link-update" href="javascript:void(0)">取消置顶</a>
                    <?php }else{?>
                        <a class="link-update" href="javascript:void(0)">置顶</a>
                    <?php }?>
                </td>
            </tr>
            <tr>
                <td>推送时间:</td>
                <td>
                    <input class="input-small Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:00'})" type="text" style="width: 150px;" name="pushTime" value="<?=date('Y-m-d H:i:s',$information['pushTime']) ?>"/>
                </td>

            </tr>
            <tr>
                <input type="hidden" name='id' value="<?=$information['id']?>"/>
                <input type="hidden" name='belong' value="<?=$belong?>"/>
                <input type="hidden" name='page' value="<?=$page?>"/>
                <td></td>

                <td align="right">
                    <button class="btn btn-primary" type="button"  id="subnews" >提交</button>
                </td>
                <td>
                    <button class="btn btn-primary" type="button"  id="editnews">编辑</button>
                </td>
            </tr>
        </table>
    </form>

</div>

<script type="text/javascript">
    $('.link-update').click(function(){
        var isTop = $(".isTop").val();
        if (isTop == "1") {
            $(".isTop").val("0");
            $(".link-update").text("置顶");
        } else {
            $(".isTop").val("1");
            $(".link-update").text("取消置顶");
        }
    })
    $("#editnews").click(function(){
        var form = $("#registerform");
        form.prop("action","<?=\yii\helpers\Url::to(['information/edit'])?>");
        form.submit();
        // location.href='index.php?content-master-xdfzx&page='+page+'&belong='+belongval;
    });

    $("#subnews").click(function(){
        var form = $("#registerform");
        form.prop("action","<?=\yii\helpers\Url::to(['information/sub'])?>");
        form.submit();
        // location.href='index.php?content-master-xdfzx&page='+page+'&belong='+belongval;
    });

</script>


